package com.example.train_operate.ws.model;

import lombok.Data;
import org.springframework.web.socket.WebSocketSession;

import java.time.Instant;

@Data
public class OnlineUser {
    private String userId;
    private String userName;
    private String displayName;
    private String sessionId;
    private String deviceType;
    private WebSocketSession session;
    private Instant lastActive;
    // "IDLE", "CALLING", "IN_CALL"
    private String callStatus;
    public OnlineUser(String userId, String userName, String displayName, String sessionId,
                      String deviceType, WebSocketSession session) {
        this.userId = userId;
        this.userName = userName;
        this.displayName = displayName;
        this.sessionId = sessionId;
        this.deviceType = deviceType;
        this.session = session;
        this.lastActive = Instant.now();
        this.callStatus = "IDLE";
    }

    public void updateLastActive(){this.lastActive = Instant.now();}
}
